# -*- coding:utf-8 -*-

import sys

statDay = sys.argv[1]
mergeDir = "merge_dmarket_access_log"
subFix = "-dmarket_access_log"
fileDir = mergeDir + "/" + str(statDay) + subFix
f = open(fileDir, "r")
d = {}
for line in f:
    logStr = line.split("\"")
    ipDate = logStr[0]
    requestUrl = logStr[1]
    userAgent = logStr[5]
    responseTime = logStr[8]

    d['ip_time'] = ipDate
    d['request_url'] = requestUrl
    d['user_agent'] = userAgent
    d['response_time'] = responseTime

    print d
f.close()
